home *** CD-ROM | disk | FTP | other *** search
/ Aminet 4 / Aminet 4 - November 1994.iso / aminet / comm / bbs / excelpoll13.lha / ExcelPollFrontDoor.rexx < prev    next >
OS/2 REXX Batch file  |  1994-07-17  |  3KB  |  140 lines

  1. /* EXCELSIOR BBS SYSTEM VOTING DOOR
  2.    Version 1.2a (Arexx Version)
  3.  
  4. ***  LOGON FRONT DOOR  ***
  5.  
  6.    © 1994 Daniel Makovec
  7.     Project initiated Saturday 2nd July 1994
  8.     Completion: Sunday 17th July 1994
  9. */
  10.  
  11. Signal on BREAK_C                        /* User can't terminate the prog with a CTRL-C */
  12. clear
  13.  
  14. /*****************************************************************************************************/
  15.  
  16. /*                  Change these settings to personal preference                                     */
  17.  
  18. MinAccess    = 1                            /* Access at which user can add topics                       */
  19. MaxAccess    = 32
  20. DoorPath    = 'Doors:'
  21. TempPath    = 'RAM:t/'                    /* Path where new files are written to for increase in speed */
  22. TopicPath    = 'Doors:'                    /* Path were 'hard copies' of files are kept on HD           */
  23. UserFile    = 'vote.users'                /* Name of file where user voting records are kept           */
  24.  
  25. /*****************************************************************************************************/
  26.  
  27. options results
  28.  
  29. address command 'c:copy 'TopicPath||UserFile' 'TempPath||UserFile    /* If hardcopy file exists, copy to RAM */
  30.  
  31. TR            = Transmit
  32. QU            = Query
  33. GU            = getuser
  34.  
  35. UFileName    = TempPath||UserFile
  36.  
  37. Final        = 0
  38. Rec = 'rec'
  39. User = 'user'
  40.  
  41. call CheckUser
  42. call CheckUnTouched
  43. exit
  44.  
  45.  
  46.  
  47. CheckUser:
  48.  
  49.  
  50. GU 40
  51. ID = RESULT
  52. GU 15
  53. Access = RESULT
  54. if Access >= MinAccess & Access <= MaxAccess then
  55.     call ScanForTopics
  56. Return
  57. ScanForTopics:
  58.  
  59. if open('UFile', UFileName, 'R') then
  60.     do
  61.         NumOfUsers = Readln('UFile')                                /* Get total registered booth system users */
  62.         Final = Readln('UFile')
  63.         do count = 1 to NumOfUsers
  64.             rec.count = readln('UFile')                                /* User ID of record */
  65.             do Num = 1 to Final
  66.                 Rec.count.Num = readln('UFile')                        /* User's vote */
  67.             end
  68.         end
  69.         if ID > NumOfUsers then                                        /* If user has never used system before, initialize account */
  70.             do Num = 1 to Final
  71.                 rec.ID.Num = 0
  72.  
  73.             end
  74.         do Num = 1 to Final
  75.             if rec.ID.Num ~= 0 then
  76.                 User.ID.Num.Seen = 'Y'
  77.             else
  78.                 User.ID.Num.Seen = 'N'
  79.         end
  80.         close('UFile')
  81.     end
  82. else
  83.     do
  84.         if exists(TopicPath||UserFile) then                        /* See if hardcopy file exists.*/
  85.             do
  86.                 address command
  87.                 'run >NIL: copy 'TopicPath||UserFile' 'TempPath    /* If hardcopy file exists, copy to RAM */
  88.                 Call UserDataLoad                                /* and re attempt file load */
  89.             end
  90.         else
  91.             do
  92.                 Users = 0
  93.                 do Num = 1 to final    
  94.                     User.ID.Num.Seen = 'N'
  95.                 end
  96.             end
  97.     end
  98. RETURN
  99.  
  100. CheckUnTouched:
  101. UnSeen = 0
  102. do Num = 1 to final
  103.     if User.ID.Num.Seen = 'N' then
  104.         UnSeen = UnSeen + 1
  105. end
  106. if UnSeen > 0 then
  107.     do
  108.         TR
  109.         if UnSeen > 1 then
  110.             TR 'You have not voted on 'UnSeen' topics.'
  111.         else 
  112.             TR 'You have not voted on a topic.'
  113.  
  114.         QueryY 'Do you wish to vote now? (Y/n) : '
  115.         ANS = left(RESULT,1)
  116.  
  117.         if ANS = 'Y' then
  118.             RUNDOOR DoorPath||'ExcelPoll.rexx'
  119.     end
  120. exit
  121. RETURN
  122.  
  123. BREAK_C:
  124. /* This will allow a program to exit cleanly and safely, instead of breaking and
  125.    leaving files open, possibly DOS interface running */
  126.  
  127. Return
  128.  
  129. FinishFile:
  130. address command
  131. 'Run >NIL: C:Copy >NIL: 'TFileName' 'TopicPath
  132. 'Run >NIL: C:Copy >NIL: 'UFileName' 'TopicPath
  133. Return
  134.  
  135. ScrHeader:
  136.     TR  '              ' red'                     EXCELPOLL'
  137.     TR  '              ' yellow'                    Version 1.2'
  138.     TR  '              ' cyan'              By Daniel (Mav) Makovec'
  139.     TR
  140. Return